home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / news / inn1.000 / inn1.4sec-linux-src.tar / inn / syslog / syslog.h < prev    next >
C/C++ Source or Header  |  1992-07-24  |  5KB  |  146 lines

  1. /* $Revision: 1.3 $
  2.  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution is only permitted until one year after the first shipment
  6.  * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
  7.  * binary forms are permitted provided that: (1) source distributions retain
  8.  * this entire copyright notice and comment, and (2) distributions including
  9.  * binaries display the following acknowledgement:  This product includes
  10.  * software developed by the University of California, Berkeley and its
  11.  * contributors'' in the documentation or other materials provided with the
  12.  * distribution and in all advertising materials mentioning features or use
  13.  * of this software.  Neither the name of the University nor the names of
  14.  * its contributors may be used to endorse or promote products derived from
  15.  * this software without specific prior written permission.
  16.  * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  17.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  18.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  19.  *
  20.  *    @(#)syslog.h    7.16 (Berkeley) 6/28/90
  21.  */
  22.  
  23. /*
  24.  * priorities/facilities are encoded into a single 32-bit quantity, where the
  25.  * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
  26.  * (0-big number).  Both the priorities and the facilities map roughly
  27.  * one-to-one to strings in the syslogd(8) source code.  This mapping is
  28.  * included in this file.
  29.  *
  30.  * priorities (these are ordered)
  31.  */
  32. #define    LOG_EMERG    0    /* system is unusable */
  33. #define    LOG_ALERT    1    /* action must be taken immediately */
  34. #define    LOG_CRIT    2    /* critical conditions */
  35. #define    LOG_ERR        3    /* error conditions */
  36. #define    LOG_WARNING    4    /* warning conditions */
  37. #define    LOG_NOTICE    5    /* normal but significant condition */
  38. #define    LOG_INFO    6    /* informational */
  39. #define    LOG_DEBUG    7    /* debug-level messages */
  40.  
  41. #define    LOG_PRIMASK    0x007    /* mask to extract priority part (internal) */
  42.                 /* extract priority */
  43. #define    LOG_PRI(p)    ((p) & LOG_PRIMASK)
  44. #define    LOG_MAKEPRI(fac, pri)    (((fac) << 3) | (pri))
  45.  
  46. #ifdef SYSLOG_NAMES
  47. #define    INTERNAL_NOPRI    0x10    /* the "no priority" priority */
  48.                 /* mark "facility" */
  49. #define    INTERNAL_MARK    LOG_MAKEPRI(LOG_NFACILITIES, 0)
  50. typedef struct _code {
  51.     char    *c_name;
  52.     int    c_val;
  53. } CODE;
  54.  
  55. CODE prioritynames[] = {
  56.     "alert",    LOG_ALERT,
  57.     "crit",        LOG_CRIT,
  58.     "debug",    LOG_DEBUG,
  59.     "emerg",    LOG_EMERG,
  60.     "err",        LOG_ERR,
  61.     "error",    LOG_ERR,        /* DEPRECATED */
  62.     "info",        LOG_INFO,
  63.     "none",        INTERNAL_NOPRI,        /* INTERNAL */
  64.     "notice",    LOG_NOTICE,
  65.     "panic",     LOG_EMERG,        /* DEPRECATED */
  66.     "warn",        LOG_WARNING,        /* DEPRECATED */
  67.     "warning",    LOG_WARNING,
  68.     NULL,        -1,
  69. };
  70. #endif
  71.  
  72. /* facility codes */
  73. #define    LOG_KERN    (0<<3)    /* kernel messages */
  74. #define    LOG_USER    (1<<3)    /* random user-level messages */
  75. #define    LOG_MAIL    (2<<3)    /* mail system */
  76. #define    LOG_DAEMON    (3<<3)    /* system daemons */
  77. #define    LOG_AUTH    (4<<3)    /* security/authorization messages */
  78. #define    LOG_SYSLOG    (5<<3)    /* messages generated internally by syslogd */
  79. #define    LOG_LPR        (6<<3)    /* line printer subsystem */
  80. #define    LOG_NEWS    (7<<3)    /* network news subsystem */
  81. #define    LOG_UUCP    (8<<3)    /* UUCP subsystem */
  82. #define    LOG_CRON    (15<<3)    /* clock daemon */
  83.     /* other codes through 15 reserved for system use */
  84. #define    LOG_LOCAL0    (16<<3)    /* reserved for local use */
  85. #define    LOG_LOCAL1    (17<<3)    /* reserved for local use */
  86. #define    LOG_LOCAL2    (18<<3)    /* reserved for local use */
  87. #define    LOG_LOCAL3    (19<<3)    /* reserved for local use */
  88. #define    LOG_LOCAL4    (20<<3)    /* reserved for local use */
  89. #define    LOG_LOCAL5    (21<<3)    /* reserved for local use */
  90. #define    LOG_LOCAL6    (22<<3)    /* reserved for local use */
  91. #define    LOG_LOCAL7    (23<<3)    /* reserved for local use */
  92.  
  93. #define    LOG_NFACILITIES    24    /* current number of facilities */
  94. #define    LOG_FACMASK    0x03f8    /* mask to extract facility part */
  95.                 /* facility of pri */
  96. #define    LOG_FAC(p)    (((p) & LOG_FACMASK) >> 3)
  97.  
  98. #ifdef SYSLOG_NAMES
  99. CODE facilitynames[] = {
  100.     "auth",        LOG_AUTH,
  101.     "cron",     LOG_CRON,
  102.     "daemon",    LOG_DAEMON,
  103.     "kern",        LOG_KERN,
  104.     "lpr",        LOG_LPR,
  105.     "mail",        LOG_MAIL,
  106.     "mark",     INTERNAL_MARK,        /* INTERNAL */
  107.     "news",        LOG_NEWS,
  108.     "security",    LOG_AUTH,        /* DEPRECATED */
  109.     "syslog",    LOG_SYSLOG,
  110.     "user",        LOG_USER,
  111.     "uucp",        LOG_UUCP,
  112.     "local0",    LOG_LOCAL0,
  113.     "local1",    LOG_LOCAL1,
  114.     "local2",    LOG_LOCAL2,
  115.     "local3",    LOG_LOCAL3,
  116.     "local4",    LOG_LOCAL4,
  117.     "local5",    LOG_LOCAL5,
  118.     "local6",    LOG_LOCAL6,
  119.     "local7",    LOG_LOCAL7,
  120.     NULL,        -1,
  121. };
  122. #endif
  123.  
  124. #ifdef KERNEL
  125. #define    LOG_PRINTF    -1    /* pseudo-priority to indicate use of printf */
  126. #endif
  127.  
  128. /*
  129.  * arguments to setlogmask.
  130.  */
  131. #define    LOG_MASK(pri)    (1 << (pri))        /* mask for one priority */
  132. #define    LOG_UPTO(pri)    ((1 << ((pri)+1)) - 1)    /* all priorities through pri */
  133.  
  134. /*
  135.  * Option flags for openlog.
  136.  *
  137.  * LOG_ODELAY no longer does anything.
  138.  * LOG_NDELAY is the inverse of what it used to be.
  139.  */
  140. #define    LOG_PID        0x01    /* log the pid with each message */
  141. #define    LOG_CONS    0x02    /* log on the console if errors in sending */
  142. #define    LOG_ODELAY    0x04    /* delay open until first syslog() (default) */
  143. #define    LOG_NDELAY    0x08    /* don't delay open */
  144. #define    LOG_NOWAIT    0x10    /* don't wait for console forks: DEPRECATED */
  145. #define    LOG_PERROR    0x20    /* log to stderr as well */
  146.